home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1991 …esperately Seeking Seven / Desperately Seeking Seven.2mg / Dev.CD.8 / Essentials / Tools / File.Type.Notes / FTN.50.8010 < prev    next >
Encoding:
Text File  |  1990-07-27  |  28.0 KB  |  503 lines  |  [04] ASCII Text (0x0000)

  1. Apple II
  2. File Type Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6. File Type:         $50 (80)
  7. Auxiliary Type:    $8010
  8.  
  9. Full Name:     AppleWorks GS Word Processor File
  10. Short Name:    AppleWorks GS Word Processor
  11.  
  12. Revised by:    Matt Deatherage & Dave Lyons                    September 1990
  13. Written by:    Sydney R. Polk & Stephan Schwirzke,                  July 1990
  14.                Claris Corporation
  15.                Matt Deatherage, Apple Computer, Inc.
  16.  
  17. Files of this type and auxiliary type contain word processor documents from 
  18. AppleWorks GS.
  19. Changes since July 1990:  Corrected the document format to include a count of 
  20. the SaveArray entries, since such a count there is.  Also added a description 
  21. of how to count rulers.
  22. _____________________________________________________________________________
  23.  
  24. AppleWorks GS is an integrated desktop productivity system for the Apple IIgs 
  25. personal computer.  AppleWorks GS includes a word processor, spreadsheet, data 
  26. base, communications module and page layout module in one program.  The word 
  27. processor (whose file format is described herein) is paragraph-based and 
  28. allows multiple fonts, styles, sizes, colors and rulers.
  29.  
  30. For more information on AppleWorks GS, contact:
  31.  
  32.                     Claris Corporation
  33.                     5201 Patrick Henry Drive
  34.                     P.O. Box 58168
  35.                     Santa Clara, CA 95052-8168
  36.  
  37.                     Technical Support
  38.                     Telephone:  (408) 727-9054
  39.                     AppleLink:  Claris.Tech
  40.  
  41.                     Customer Relations
  42.                     Telephone:  (408) 727-8227
  43.                     AppleLink:  Claris.CR
  44.  
  45. The AppleWorks GS file format is copyrighted (C) 1990 by Claris Corporation and 
  46. is printed here with permission.
  47.  
  48.  
  49. Definitions
  50.  
  51. The following definitions are used in this document in addition to those 
  52. defined for all Apple II file types:
  53.  
  54. Paragraph     An AppleWorks GS paragraph consists of a paragraph header and a 
  55.               carriage return ($0D) with text in between.  The paragraph 
  56.               header is defined later in this Note.
  57.  
  58. Font change   A font change is signified by the one Byte token $01, followed 
  59.               by the Word new font family number.
  60.  
  61. Style change  A style change is signified by the one Byte token $02 followed 
  62.               by the new Style Byte.  The format of the Style Byte is 
  63.               included in this section.
  64.  
  65. Size change   A size change is signified by the one Byte token $03, followed 
  66.               by the Byte new font size.
  67.  
  68. Color change  A color change is signified by the one Byte token $04, followed 
  69.               by the Byte new color.  The color is an offset (0-15) into 
  70.               QuickDraw II color table number zero.  
  71.  
  72. Style Byte    A style byte is a Byte of bit flags, defined as follows:
  73.  
  74.               Bit 7:    Subscript
  75.               Bit 6:    Superscript
  76.               Bit 5:    Reserved for future use
  77.               Bit 4:    Shadow
  78.               Bit 3:    Outline
  79.               Bit 2:    Underline
  80.               Bit 1:    Italic
  81.               Bit 0:    Bold
  82.  
  83.               When using a Style Byte with QuickDraw II, be sure to mask out 
  84.               bits 6 and 7 as QuickDraw II does not support these styles.
  85.  
  86. Text Block    The Text Block is how AppleWorks GS stores text in memory.  The 
  87.               format is as follows:
  88.  
  89.               blockSize  (+000)  Word        The length of this Text Block, 
  90.                                              including the block size.
  91.               blockUsed  (+002)  Word        The number of bytes actually 
  92.                                              used by this Text Block.  
  93.                                              If this is less than blockSize, 
  94.                                              the remaining bytes should be 
  95.                                              ignored. This will not happen on 
  96.                                              disk.
  97.               theText    (+004)  Paragraphs  Paragraphs, as defined in this 
  98.                                              section.
  99.  
  100.               Paragraphs are stored consecutively within Text Blocks, and a 
  101.               paragraph is not split over two or more Text Blocks.  If there 
  102.               is more than one Text Block, consecutive Text Blocks contain 
  103.               consecutive sets of paragraphs.
  104.  
  105. Text Block Records
  106.               Text Block Records consist of a Long giving the size followed 
  107.               by a text block.  A Text Block Record is redundant.
  108.  
  109. Reserved Characters
  110.               ASCII characters $01-$07 have special meaning in an 
  111.               AppleWorks GS WP file and are considered special characters.
  112.               Character $09 has is the Tab character and character $0D is 
  113.               the only paragraph ending character, the Return.
  114.  
  115.               $01:  Font change   described in this section
  116.               $02:  Style change  described in this section
  117.               $03:  Size change   described in this section
  118.               $04:  Color change  described in this section
  119.               $05:  Page token    to be replaced with the page number of 
  120.                                   this page 
  121.               $06:  Date token    to be replaced with the current ASCII date 
  122.               $07:  Time token    to be replaced with the current ASCII time
  123.  
  124. Dates and times are in the "Thursday, July 5th, 1989 06:30 PM" 
  125. format.
  126.  
  127.               $09:  Tab           the tab character
  128.               $0D:  Return        ends a paragraph
  129.  
  130. Paragraph header
  131.               A paragraph header is seven bytes long:
  132.  
  133.               firstFont  (+000)  Word        Font family number of the first 
  134.                                              character in the paragraph.
  135.               firstStyle (+002)  Style Byte  The style of the first character 
  136.                                              in the paragraph.
  137.               firstSize  (+003)  Byte        The size (in points) of the 
  138.                                              first character in the paragraph.
  139.               firstColor (+004)  Byte        The color of the first character 
  140.                                              in the paragraph, as an offset 
  141.                                              into QuickDraw II color table 
  142.                                              zero.
  143.               reserved   (+005)  Word        Reserved for future use.
  144.  
  145. Document header
  146.               A document header is found at the beginning of every AppleWorks 
  147.               GS word processing file.  The header begins at offset zero and 
  148.               is 282 bytes long:
  149.  
  150.               version    (+000)  Word        The version number of the file 
  151.                                              format.  This is $1011 for 
  152.                                              AppleWorks GS version 1.0v2 
  153.                                              and 1.1.
  154.               headerSize (+002)  Word        Total size of the header in 
  155.                                              bytes.  This is 282 ($11A) for
  156.                                              version $0100.
  157.               refRecSize (+004)  Word        Size of the reference record 
  158.                                              (fields rBits through rColor) in 
  159.                                              bytes.  Always 48 ($30).
  160.               rBits      (+006)  22 Bytes    Each word in rBits 
  161.                                              is a bit flag representing 
  162.                                              the state of one of the 
  163.                                              AppleWorks GS menus when 
  164.                                              the file was saved.  For 
  165.                                              example, if bit 0 of the 
  166.                                              fourth word is clear, then 
  167.                                              the first item in the 
  168.                                              fourth menu was disabled 
  169.                                              when the file was saved.
  170.               rUndo      (+028)  Long        Reserved; set to zero.
  171.               rState     (+032)  Long        Reserved; set to zero.
  172.               rNum       (+036)  Word        Reserved; set to zero.
  173.               rRefCon    (+038)  Long        Reserved; set to zero.
  174.               rChange    (+042)  Long        Reserved; set to zero.
  175.               rPrint     (+046)  Long        Reserved; set to zero.
  176.               rColor     (+050)  Long        Reserved; set to zero.
  177.               cTabSize   (+054)  Word        Size of the color 
  178.                                              table in bytes.  This is 
  179.                                              always 64.  This is twice 
  180.                                              as large as needed; the 
  181.                                              second 32 bytes of color 
  182.                                              table space are reserved 
  183.                                              for future expansion.
  184.               colorTable (+056)  32 Bytes    The QuickDraw II 
  185.                                              color table for this 
  186.                                              document.
  187.               reserved   (+082)  32 Bytes    Reserved for 
  188.                                              future expansion.  The size 
  189.                                              of this field is included 
  190.                                              in cTabSize.
  191.               pRecSize   (+120)  Word        Size of the print 
  192.                                              record in bytes.  This is 
  193.                                              always 160.
  194.               printRecord (+122) 160 Bytes   A Print 
  195.                                              Manager print record for 
  196.                                              this document.
  197.  
  198. Word Processor Global Variables
  199.               Some global variables for the document are calculated after the 
  200.               file is read; these are marked "reserved."  The total size of 
  201.               the globals is 386 bytes.  The document is actually stored as 
  202.               three documents--the text, the header and the footer, as is 
  203.               described in the "File Structure" section of this Note.  The 
  204.               AppleWorks GS word processor swaps a section of data depending 
  205.               on whether the text, header or footer was showing when the file 
  206.               was saved.  The first section reflects the state of the 
  207.               document at save time and is a duplicate of one of the other 
  208.               three sections, depending on the value of "stuff".  The 
  209.               switched variables are defined in this section as "SwapVars."
  210.  
  211.               intVersion  (+000)  Word       AWGS WP internal version; 
  212.                                              currently $0002.
  213.               view        (+002)  Word       The current view.  
  214.                                              Possible values are $0000 
  215.                                              for the text, $0001 for the 
  216.                                              header and $FFFF (-1) for 
  217.                                              the footer.
  218.               stuff       (+004)  Word       Indicates which 
  219.                                              sections variables were 
  220.                                              swapped in when the file 
  221.                                              was saved.  Possible values 
  222.                                              are $0000 for the text, 
  223.                                              $0001 for the header and 
  224.                                              $FFFF (-1) for the footer.
  225.               curDate     (+006)  String     The ASCII date 
  226.                                              when the file was saved.  
  227.                                              This field always takes 26 
  228.                                              bytes regardless of the 
  229.                                              length of the string.
  230.               curTime     (+032)  String     The ASCII time 
  231.                                              when the file was saved.  
  232.                                              This field always takes 10 
  233.                                              bytes regardless of the 
  234.                                              length of the string.
  235.  
  236.               Dates and times are in the "Thursday, July 5th, 1989 06:30 PM" 
  237.               format.
  238.  
  239.               curPageNum  (+042)  String     The ASCII current 
  240.                                              page number (e.g., "15").  
  241.                                              This field always takes 8 
  242.                                              bytes regardless of the 
  243.                                              length of the string.
  244.  
  245.               The next seven fields are used in headers and footers for 
  246.               time, date and page tokens.
  247.  
  248.               docPages    (+050)  Word       Number of pages in 
  249.                                              current document.
  250.               startPage   (+052)  Word       Number with which 
  251.                                              to start pagination.
  252.               reserved    (+054)  Word       Reserved; set to 
  253.                                              zero when writing.
  254.               visRuler    (+056)  Word       Boolean; FALSE ($0000) 
  255.                                              if ruler is not showing, 
  256.                                              TRUE ($0001) if it is.
  257.               reserved    (+058)  Long       Reserved; set to 
  258.                                              zero when writing.
  259.               headerHeight (+062) Word       Height of header 
  260.                                              in pixels; maximum of 110.
  261.               footerHeight (+064) Word       Height of footer 
  262.                                              in pixels; maximum of 110.
  263.  
  264.               The next 80 bytes are swapped out variables defined in 
  265.               this section:
  266.  
  267.               currentVars (+066)  SwapVars   80 bytes 
  268.                                              reflecting current 
  269.                                              variables when the document 
  270.                                              was saved.
  271.               docVars     (+146)  SwapVars   The document's variables.
  272.               headerVars  (+226)  SwapVars   The header's variables.
  273.               footerVars  (+306)  SwapVars   The footer's variables.
  274.  
  275. SwapVars      The SwapVars are variables that are different for the text, 
  276.               header and footer.  The set of SwapVars in docVars is the 
  277.               variables at the time the file was saved.  The remaining three 
  278.               sets of SwapVars apply to their sections of the file.
  279.  
  280.               reserved    (+000)  Long       Reserved; set to 
  281.                                              zero when writing.
  282.               reserved    (+004)  Long       Reserved; set to 
  283.                                              zero when writing.
  284.               reserved    (+008)  Word       Reserved; set to 
  285.                                              zero when writing.
  286.               lastPrgph   (+010)  Word       The number of the 
  287.                                              last defined paragraph in 
  288.                                              the document.  Paragraphs 
  289.                                              are numbered from one.
  290.               pageSize    (+012)  Word       Page size 
  291.                                              (vertically), in pixels.
  292.               topSpace    (+014)  Word       Top space above 
  293.                                              page, in pixels.
  294.               bottomSpace (+016)  Word       Bottom space below 
  295.                                              page, in pixels.
  296.               paperSize   (+018)  Word       Paper size 
  297.                                              (vertically), in pixels.
  298.               horRulerRes (+020)  Word       Horizontal resolution 
  299.                                              for ruler, in pixels
  300.               oPageRect   (+022)  Word       Offset from paper 
  301.                                              to page rect, horizontally, 
  302.                                              in pixels.
  303.               windPage    (+024)  Word       The page number 
  304.                                              that begins the current 
  305.                                              window.
  306.               lineOffset  (+026)  Word       How far down the 
  307.                                              top page the window starts, 
  308.                                              in pixels.
  309.               firstPrgph  (+028)  Word       Number of the 
  310.                                              paragraph (paragraphs are 
  311.                                              numbered from one) that has 
  312.                                              the first text on this page.
  313.               firstLine   (+030)  Word       Number of the 
  314.                                              first line in this 
  315.                                              paragraph in the window.
  316.               height      (+032)  Word       The height of the 
  317.                                              paragraph before the first 
  318.                                              line, in pixels in the window.
  319.               topSel      (+034)  Word       The paragraph 
  320.                                              number of the topmost 
  321.                                              portion of the selection, 
  322.                                              or zero for no selection.
  323.               topSelLine  (+036)  Word       The line number of 
  324.                                              the topmost portion of the 
  325.                                              selection.
  326.               selOffset   (+038)  Word       The offset into 
  327.                                              the paragraph in bytes of 
  328.                                              the first character of the 
  329.                                              selection.
  330.               reserved    (+040)  Long       Reserved; set to 
  331.                                              zero when writing.
  332.               insFlag     (+044)  Word       Zero for a single 
  333.                                              insertion point, one for a 
  334.                                              selected range.
  335.               caretEnd    (+046)  8 Bytes    End points of the 
  336.                                              caret line.  
  337.               rangePar    (+054)  Word       The paragraph number of the 
  338.                                              end of the selection.
  339.               rangeLine   (+056)  Word       The line number of 
  340.                                              the end of the selection.
  341.               rangeOffset (+058)  Word       The offset of the 
  342.                                              end of the selection
  343.               stylePending (+060) Boolean Word
  344.                                              TRUE if the current font 
  345.                                              has been changed but 
  346.                                              nothing has been typed.
  347.               fontID      (+062)  Long       The font ID of the 
  348.                                              current font.
  349.               color       (+066)  Word       The low byte is the current 
  350.                                              color byte (0-15); the 
  351.                                              high byte is zero.
  352.               topPrgphLine (+068) Word       The top paragraph 
  353.                                              on the screen.
  354.               topLine     (+070)  Word       The top line of the paragraph 
  355.                                              on the screen.
  356.               topPB       (+072)  Word       Top page boundary--
  357.                                              the page number of the top 
  358.                                              line in the window.
  359.               bottomPrgph (+074)  Word       Paragraph number of the 
  360.                                              bottom paragraph on screen 
  361.               bottomLine  (+076)  Word       Bottom line on screen
  362.               bottomPB    (+078)  Word       Bottom page boundary--
  363.                                              the page number of the 
  364.                                              bottom line in the window.
  365.  
  366. SaveArray entry
  367.               In the main document there will be one entry in a SaveArray for 
  368.               each paragraph in the document.  Each entry is 12 bytes:
  369.  
  370.               textBlock   (+000)  Word       Text Block number.  
  371.                                              Text Blocks are numbered 
  372.                                              from zero in the document; 
  373.                                              this entry shows in which 
  374.                                              text block this paragraph 
  375.                                              can be found.
  376.               offset      (+002)  Word       Adding this value 
  377.                                              to the offset of the text 
  378.                                              block gives the beginning 
  379.                                              of the paragraph.
  380.               attributes  (+004)  Word       $0000 = Normal text, 
  381.                                              $0001 = page break paragraph.
  382.               rulerNum    (+006)  Word       Number of the 
  383.                                              ruler associated with this 
  384.                                              paragraph.  If this 
  385.                                              paragraph is a page break 
  386.                                              paragraph, ignore this field.
  387.               pixelHeight (+008)  Word       Height of this 
  388.                                              paragraph in pixels.
  389.               numLines    (+010)  Word       Number of lines in 
  390.                                              this paragraph.
  391.  
  392. Ruler         Each paragraph has a ruler associated with it; the rulers are 
  393.               stored in the order in which they appear in the document and are 
  394.               numbered consecutively beginning with zero.  Rulers are 52 bytes 
  395.               long and have the following structure:
  396.  
  397.               numParagraphs (+000) Word      The number of paragraphs 
  398.                                              using this ruler.
  399.               statusBits  (+002)  Flag Word  Bits 15-8:  Reserved for 
  400.                                                          future use.
  401.                                              Bit 7:      Full justification
  402.                                              Bit 6:      Right justification
  403.                                              Bit 5:      Center justification
  404.                                              Bit 4:      Left justification
  405.                                              Bit 3:      Paragraph cannot 
  406.                                                          break pages if this 
  407.                                                          bit is set.
  408.                                              Bit 2:      Triple spaced 
  409.                                                          (really double)
  410.                                              Bit 1:      Double spaced 
  411.                                                          (really one and 
  412.                                                          one half)
  413.                                              Bit 0:      Single spaced
  414.               leftMargin  (+004)  Word       Left margin in 
  415.                                              pixels from the left edge 
  416.                                              of the window.
  417.               indentMargin (+006) Word       Indent margin in 
  418.                                              pixels from the left edge 
  419.                                              of the window.
  420.               rightMargin (+008)  Word       Right margin in 
  421.                                              pixels from the left edge 
  422.                                              of the window.
  423.               numTabs     (+010)  Word       This will be a 
  424.                                              number from one to ten; 
  425.                                              there is always at least 
  426.                                              one tab.
  427.               tabRecs     (+012)             10 Tab Records
  428.                                              A tab record is defined in 
  429.                                              the following section.
  430.  
  431. Because rulers are defined consecutively from zero, you can use the SaveArray 
  432. entries to find the total number of rulers.  Look at the ruler number for each 
  433. SaveArray entry; the highest-numbered ruler you find is an indication of the 
  434. ruler count.  For example, if the highest rulerNum in any SaveArray entry is 
  435. $0003, there are four rulers in the document.
  436.  
  437. Tab Record    A tab record identifies the type of tab in a ruler:
  438.  
  439.               tabLocation (+000)  Word       The location of the tab, 
  440.                                              in pixels, from the left edge 
  441.                                              of the screen.
  442.               tabType     (+002)  Word       The type of tab.  
  443.                                              $0000 is a left tab; $0001 
  444.                                              is a right tab, and -1 ($FFFF) 
  445.                                              is a decimal tab, which 
  446.                                              centers around period characters.
  447.  
  448.  
  449. File Format and Structure
  450.  
  451. The AppleWorks GS Word Processor file is composed of sections defined in 
  452. "Definitions."  The document structure is as follows:
  453.  
  454.               docHeader   (+000)  Document Header
  455.               globals     (+282)  WP Globals
  456.               docSACount  (+668)  Word       Number of SaveArray 
  457.                                              entries to follow
  458.               docSaveArray (+670) SaveArray entries
  459.                                              One entry for each paragraph
  460.               docRulers   (+xxx)  Rulers     The rulers start here.  
  461.                                              "xxx" is at +670 + 12* the 
  462.                                              number of paragraphs.
  463.               docTextBlocks (+yyy) Text Block Records
  464.                                              The text block records start 
  465.                                              here.  Note that when saved to 
  466.                                              disk, there is no extra space in 
  467.                                              a Text Block so the size is 
  468.                                              equal to the used field.  
  469.                                              "yyy" is at "xxx"+52*number of 
  470.                                              rulers.
  471.               headSaveArray       SaveArray entries
  472.                                              SaveArray entries for this 
  473.                                              document's header.  The offset 
  474.                                              depends on the length of the 
  475.                                              document's text blocks.
  476.               headRulers          Rulers     The rulers for the header.
  477.               headTextBlocks      Text Block Records
  478.                                              The text for the header.
  479.               footSaveArray       SaveArray entries
  480.                                              The SaveArray entries for this 
  481.                                              document's footer.
  482.               footRulers          Rulers     The rulers for the footer.
  483.               footTextBlocks      Text Block Records
  484.                                              The text for the footer.
  485.  
  486. Please note that the number of paragraphs stored in the document is always one 
  487. greater than the number displayed in the window.  The last character is always 
  488. a Return character.  The number of carriage returns displayed is equal to the 
  489. number of carriage returns stored minus one.  This is so all of the paragraphs 
  490. are guaranteed to end in a carriage return internally.
  491.  
  492. Blank document sections have a zero in the lastPrgph field of the SwapVars and 
  493. have no save arrays, rulers, or text blocks.
  494.  
  495. The maximum number of paragraphs in a document is 64K-1 (65,535) and the 
  496. maximum number of characters in a paragraph is 64K-13 (65,523), giving a 
  497. maximum theoretical document size of a healthy 4,294,049,805 characters.
  498.  
  499. Further Reference
  500. _____________________________________________________________________________
  501.   o  Apple IIgs Toolbox Reference, Volumes 1 through 3
  502.  
  503.